package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.common.params.PageQueryParam;
import com.itheima.common.vo.Result;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.service.CheckGroupService;
import com.itheima.service.CheckItemService;
import org.springframework.web.bind.annotation.*;

//No provider available
@RestController
@RequestMapping("checkGroup")
public class CheckGroupController {

    @Reference(version = "1.0")
    private CheckGroupService checkGroupService;

    // /checkGroup/findPage.do
    @PostMapping("findPage")
    public Result findPage(@RequestBody PageQueryParam pageQueryParam){
        return checkGroupService.findPage(pageQueryParam);
    }
    @PostMapping("add")
    public Result add(@RequestBody CheckGroup checkGroup){
        return checkGroupService.save(checkGroup);
    }
    @PostMapping("update")
    public Result update(@RequestBody CheckGroup checkGroup){
        return checkGroupService.update(checkGroup);
    }
//
//    @GetMapping("findById/{id}")
//    public Result findById(@PathVariable("id") Integer id){
//        return checkItemService.findById(id);
//    }
//    @GetMapping("delete/{id}")
//    public Result delete(@PathVariable("id") Integer id){
//        return checkItemService.delete(id);
//    }

    @GetMapping("findAll")
    public Result findAll(Integer id){
        return checkGroupService.findAll(id);
    }
    @GetMapping("findAllCheckGroup")
    public Result findAllCheckGroup(){
        return checkGroupService.findAllCheckGroup();
    }
}
